﻿Public Class AddToFav

    Private Sub AddToFav_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = "Add to Favourites"
        Button2.Enabled = True
        TextBox2.Text = BrowserWithoutTabs1.WebBrowser1.Document.Url.ToString
        TextBox1.Text = BrowserWithoutTabs1.WebBrowser1.DocumentTitle.ToString
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        BrowserWithoutTabs1.WebBrowser1.AddToFavorites(TextBox2.Text, TextBox1.Text)
    End Sub

    'Public Sub AddToFavs(ByVal Title As String, ByVal URL As String)
    'Dim strFavoriteFolder As String
    'Retrieve the favorite folder
    'strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Favorites)
    'Create shortcut file, based on Title
    'Dim objWriter As System.IO.StreamWriter = System.IO.File.CreateText(strFavoriteFolder & "\" & Title & ".url")
    'Write the URL into the file
    'objWriter.WriteLine("[InternetShortcut]")
    'objWriter.WriteLine("URL=" & URL)
    'dispose and close
    'objWriter.Dispose()
    'objWriter.Close()
    'BrowserWithoutTabs1.LoadFavourites()
    'Me.Close()
    'End Sub
End Class